package com.qf.electronic.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qf.electronic.dto.UserDto;
import com.qf.electronic.pojo.Menu;
import com.qf.electronic.pojo.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.electronic.vo.UserVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author wu
 * @since 2023-05-04
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {

    User getUserBy(@Param("value") String usernameOrPhoneOrEmail);

    List<Menu> getUserMenus(@Param("username") String username);
    //Mybatis-plus自带分页插件，在Mapper接口中要实现分页的时候，只需要在接口方法中的第一个参数设置为分页即可
    Page<UserVo> getUsers(Page<UserVo> page, @Param("userDto") UserDto userDto);

    List<User> getExportUsers(@Param("params") Map<String, Object> params, @Param("offset") int offset, @Param("pageSize") int pageSize);

    long getExportUserCount(@Param("params") Map<String, Object> params);
}
